<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLogMessagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create( 'log_messages', function ( Blueprint $table ) {
            $table->increments( 'id' );
            $table->string( 'to_user_name', 16 )->comment( '开发者微信号' );
            $table->string( 'from_user_name', 16 )->comment( '发送方帐号（一个OpenID）' );
            $table->integer( 'create_time' )->comment( '消息创建时间 （整型）' );
            $table->string( 'msg_type', 8 )->comment( '消息类型' );
            $table->bigInteger( 'msg_id' )->comment( '消息id, 64位整型' );
            $table->string( 'event' )->nullable()->comment( '事件类型' );
            $table->string( 'even_key' )->nullable()->comment( '事件KEY值' );
            $table->string( 'ticket' )->nullable()->comment( '二维码的ticket,可用来换取二维码图片' );
            $table->string( 'latitude' )->nullable()->comment( '地理位置纬度' );
            $table->string( 'longitude' )->nullable()->comment( '地理位置经度' );
            $table->string( 'precision' )->nullable()->comment( '地理位置精度' );
            $table->text( 'content' )->nullable()->comment( '文本消息内容' );
            $table->text( 'pic_url' )->nullable()->comment( '图片链接' );
            $table->string( 'media_id' )->nullable()->comment( '媒体id, 可以调用多媒体文件下载接口拉取数据' );
            $table->string( 'format' )->nullable()->comment( '语音格式, 如amr, speex等' );
            $table->string( 'recognition' )->nullable()->comment( '语音识别结果' );
            $table->string( 'thumb_media_id' )->nullable()->comment( '视频消息缩略图的媒体id, 可以调用多媒体文件下载接口拉取数据' );
            $table->string( 'location_x' )->nullable()->comment( '地理位置维度' );
            $table->string( 'location_y' )->nullable()->comment( '	地理位置经度' );
            $table->integer( 'scale' )->nullable()->comment( '地图缩放大小' );
            $table->string( 'label' )->nullable()->comment( '地理位置信息' );
            $table->string( 'description' )->nullable()->comment( '消息描述' );
            $table->string( 'url' )->nullable()->comment( '消息链接' );
            $table->timestamps();
        } );
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop( 'log_messages' );
    }
}
